import request from '@/utils/httpRequest'

export function loginByUsername(data) {
  /*return Promise.resolve({
    code: 20000,
    data: { token: 'admin' }
  })*/
  return request({
     url: '/bsnl-authority/login',
     method: 'post',
     data
  })
}

export function getPermission() {
  /* return Promise.resolve({
    code: 20000,
    data: {
      roles: ['admin'],
      name: 'admin',
      avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
    }
  }) */
  return request({
    url: `/bsnl-authority/user/permission`,
    method: 'get'
  })
}
export function getUserInfo() {
  return Promise.resolve({
    code: 20000,
    data: {
      roles: ['admin'],
      name: 'admin',
      avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
    }
  })
  /* return request({
    url: `/bsnl-authority/user/permission/${id}`,
    method: 'get'
  }) */
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
